
(***  Commands for debugging  ***)

COMMAND DEBUG
ToggleFlag 0 (* Toggles meta-command Debug mode *)
DoneWithTurn
END_COMMAND

REM  COMMAND APB1
REM  GetIt 204  (* gold cross *)
REM  GetIt 211  (* Walkman radio ON *)
REM  GetIt 213  (* power drill *)
REM  TurnFlagON 1  (* Tark is robed *)
REM  Destroy 302 (* kill fire elemental in garage *)
REM  TurnFlagON 201 (* have heard first radio message *)
REM  TurnCounterON 1 (* and am keping track of time since I have *)
REM  GotoRoom 23 (* 59th Street *)
REM  DoneWithTurn
REM  END_COMMAND

COMMAND APB2
GetIt 204  (* gold cross *)
GetIt 211  (* Walkman radio ON *)
GetIt 213  (* power drill *)
GetIt 231  (* tagged pouch *)
GetIt 236  (* gun *)
GetIt 237  (* twinkie *)
END_COMMAND

COMMAND APB2
TurnFlagON 1  (* Tark is robed *)
Destroy 302 (* kill fire elemental in garage *)
TurnFlagON 201 (* have heard first radio message *)
TurnCounterON 1 (* and am keping track of time since I have *)
TurnFlagON 3 (* have visited Outside Castle *)
Destroy 305 (* Cindy not in mud-house *)
TurnFlagON 103 (* Cindy is a statue *)
GotoRoom 53 (* courtyard *)
DoneWithTurn
END_COMMAND

COMMAND APB3
GetIt 204  (* gold cross *)
GetIt 211  (* Walkman radio ON *)
GetIt 213  (* power drill *)
GetIt 231  (* tagged pouch *)
GetIt 236  (* gun *)
GetIt 237  (* twinkie *)
GetIt 250  (* Paisley cake *)
GetIt 251  (* spices *)
GetIt 252  (* troll box *)
GetIt 253  (* black book *)
END_COMMAND

COMMAND APB3
TurnFlagON 1  (* Tark is robed *)
Destroy 302 (* kill fire elemental in garage *)
TurnFlagON 201 (* have heard first radio message *)
TurnCounterON 1 (* and am keping track of time since I have *)
TurnFlagON 3 (* have visited Outside Castle *)
Destroy 305 (* Cindy not in mud-house *)
SendToRoom 254 91 (* Cindy is a sword in black god room *)
TurnFlagON 105  (* Tark is male *)
GotoRoom 91 (* black god room *)
DoneWithTurn
END_COMMAND

COMMAND APB4
GetIt 204  (* gold cross *)
GetIt 211  (* Walkman radio ON *)
GetIt 213  (* power drill *)
GetIt 215 (* drinking glass *)
SendToRoom 217 215  (* holy water --> drinking glass *)
GetIt 219  (* extension cord *)
GetIt 231  (* tagged pouch *)
GetIt 236  (* gun *)
GetIt 237  (* twinkie *)
GetIt 250  (* Paisley cake *)
END_COMMAND
COMMAND APB4
GetIt 251  (* spices *)
GetIt 252  (* troll box *)
GetIt 253  (* black book *)
SendToRoom 257 252  (* troll flesh --> troll box *)
GetIt 262  (* black heart *)
GetIt 263  (* cindy hair *)
SendToRoom 264 265  (* Tears of Sadness --> perfume vial *)
GetIt 265  (* perfume vial *)
GetIt 266  (* Jurbura *)
GetIt 267  (* MuiraPuma *)
GetIt 268  (* Skullcap *)
GoToRoom 3  (* kitchen *)
DoneWithTurn
END_COMMAND

REM  COMMAND APB5
REM  GetIt 282  (* clear liquid *)
REM  DoneWithTurn
REM  END_COMMAND


(*** Check on health of Cindy sword ***)

COMMAND ANY
CounterEquals 7 15  (* 10 turns since cindy sword fed *)
Present 254  (* cindy sword here *)
PrintMessage 53  (* sword bleeding less *)
END_COMMAND

COMMAND ANY
CounterEquals 7 30  (* 30 turns since cindy sword fed *)
Present 254  (* cindy sword here *)
PrintMessage 54  (* sword drying up *)
END_COMMAND

COMMAND ANY
CounterGT 7 35  (* 35 turns since cindy sword fed *)
Present 254  (* cindy sword here *)
PrintMessage 55  (* big trouble! *)
END_COMMAND

COMMAND ANY
CounterGT 7 40  (* 40 turns since cindy sword fed *)
Present 254  (* cindy sword here *)
PrintMessage 56  (* sword dies .. no point in going on *)
GoToRoom 198  (* despair -- end of game *)
TurnCounterOFF 7  (* so that this message quits *)
DoneWithTurn
END_COMMAND


(*** Commands to handle troll lord regeneration ***)

COMMAND ANY
CounterGT 8 6  (* troll lord has regenerated *)
SwapLocations 256 309  (* fragments --> troll lord *)
NOT Present 309  (* if troll lord not in current room ... *)
SendToRoom 309 83  (* ... then make sure he's in troll room *)
TurnCounterOFF 8  (* no longer regenerating *)
END_COMMAND

COMMAND ANY
CounterGT 8 6  (* troll lord just regenerated above, in current room *)
PrintMessage 162  (* he's regenerated! *)
TurnCounterOFF 8  (* no longer regenerating *)
END_COMMAND

COMMAND ANY
CounterGT 9 6  (* troll flesh or mush has regenerated outside castle *)
Present 257  (* and done so in current room, e.g. flesh here *)
OR
Present 280  (* or purple mush here *)
OR
Present 281  (* or some mush here *)
Destroy 257  (* replace troll flesh (if that's it ) ... *)
PutInCurrentRoom 309  (* by troll lord borrowed from troll room *)
PrintMessage 162  (* he's regenerated *)
TurnCounterOFF 9  (* no longer regenerating *)
END_COMMAND

COMMAND ANY
CounterGT 9 6  (* flesh regenerated outside castle but not here *)
Destroy 257  (* get rid of troll flesh, troll lord runs away *)
TurnCounterOFF 9  (* no longer regenerating *)
END_COMMAND

COMMAND ANY
AtLocationLT 50  (* we're outside the castle *)
Present 257  (* the troll flesh is here *)
CounterEquals 9 0  (* It hasn't started growing yet *)
CounterEquals 8 0  (* There aren't regenerating fragments somewhere about *)
NOT Present 309  (* and there's no troll here *)
PrintMessage 75  (* THEN ... the troll flesh starts to grow ... *)
TurnCounterON 9  (* keep track of how long it's been regenerating *)
END_COMMAND


(*** Radio announcements -- this must be toward the beginning of the CMD
     file since it always pauses at the end of the description.  If
     something else printed long description first, the two together
     might run off the screen.                                        ***)

COMMAND PLAY RADIO
RedirectTo TURN RADIO
END_COMMAND

COMMAND TURN RADIO
Present 210  (* OFF radio present *)
SwapLocations 210 211  (* swap with ON radio *)
Tone 523 1050  (* The Love Boat *)
Tone 587 450
Tone 659 450
Tone 698 450
Tone 784 450
Tone 698 450
Tone 440 1050
PrintMessage 13
DoneWithTurn
END_COMMAND

COMMAND TURN RADIO
Present 211  (* ON radio present *)
SwapLocations 211 210  (* swap with OFF radio *)
PrintMessage 14
DoneWithTurn
END_COMMAND

COMMAND ANY
Present 211 (* ON radio present *)
FlagOFF 201 (* hasn't heard message 1 yet *)
PrintMessage 201 (* print radio message 1 *)
TurnFlagON 201 (* don't print it again *)
TurnCounterON 1 (* keep track of time for future messages *)
WaitForReturn
END_COMMAND

COMMAND ANY
Present 211 (* ON radio present *)
FlagOFF 202 (* hasn't heard message 2 yet *)
CounterGT 1 40 (* 40 moves since radio first turned on *)
PrintMessage 202 (* print radio message 2 *)
TurnFlagON 202 (* don't print it again *)
WaitForReturn
END_COMMAND

COMMAND ANY
Present 211 (* ON radio present *)
FlagOFF 203 (* hasn't heard message 3 yet *)
CounterGT 1 80 (* 80 moves since radio first turned on *)
PrintMessage 203 (* print radio message 3 *)
TurnFlagON 203 (* don't print it again *)
WaitForReturn
END_COMMAND

COMMAND ANY
Present 211 (* ON radio present *)
FlagOFF 204 (* hasn't heard message 4 yet *)
CounterGT 1 120 (* 120 moves since radio first tuend on *)
PrintMessage 204 (* print radio message 4 *)
TurnFlagON 204 (* don't print it again *)
WaitForReturn
END_COMMAND


(*** Commands for attacking and being attacked -- need to be near top of
     CMD file so that attack by hostiles is always checked.  Note tha ANY
     commands always get evaluated before other ones.                  ***)

COMMAND SHOOT GUN AT ANY
PrintMessage 196  (* syntax is "SHOOT noun WITH GUN" *)
DoneWithTurn
END_COMMAND

REM  The below doesn't work 'cause a later refrence like DestroyNOUN will
REM  take NOUN to refer to the original noun GUN rather than the redirected
REM  noun.
REM
REM  COMMAND SHOOT ANY WITH GUN
REM  RedirectTo SHOOT $OBJECT$ WITH GUN
REM  END_COMMAND

COMMAND ATTACK ANY WITH GUN
RedirectTo SHOOT $NOUN$ WITH GUN
END_COMMAND

COMMAND SHOOT ANY WITH GUN
Present 236 (* gun is here *) 
FlagON 107 (* no bullet *)
PrintMessage 59
DoneWithTurn
END_COMMAND

COMMAND SHOOT ANY WITH GUN
Present 236 (* gun is here *) 
NOUNPresent
NOUNIsNumber 303 (*Survivalist*)
OR
NOUNIsNumber 304 (*police*)
PrintMessage 58 (* Survivalists kill you *)
ReDirectTo KILL_PLAYER
END_COMMAND  (* death *)

COMMAND SHOOT SKELETONS WITH GUN
FlagOFF 107  (* bullet left in gun *)
PrintMessage 63 (* can only get one *)
TurnFlagON 107
DoneWithTurn
END_COMMAND

COMMAND SHOOT MYSELF WITH GUN
Present 256  (* gun is here *)
FlagOFF 107  (* bullet left in gun *)
PrintMessage 92  (* OK -- boom! *)
TurnFlagON 107  (* bullet used up *)
ReDirectTo KILL_PLAYER
END_COMMAND

COMMAND SHOOT LORD WITH GUN
Present 236 (* gun is here *)
FlagOFF 107  (* bullet left in gun *) 
NOUNPresent
PrintMessage 57 (* you kill it bloodily *) 
SwapLocations 309 256  (* troll lord --> fragments *)
TurnFlagON 107 (* no bullet left *)
TurnCounterOFF 10  (* There is no hostile in room now *)
TurnCounterON 8  (* troll lord starts regenerating *)
DoneWithTurn
END_COMMAND

COMMAND SHOOT DEMIGOD WITH GUN
Present 236 (* gun is here *) 
FlagOFF 107  (* bullet left in gun *)
NOUNPresent
PrintMessage 100  (* you nail the bastard! *) 
SwapLocations 311 262  (* demigod --> heart *)
TurnFlagON 107 (* no bullet left *)
TurnCounterOFF 10  (* There is no hostile in room now *)
PlusScore 10  (* worth ten points *)
DoneWithTurn
END_COMMAND

COMMAND SHOOT ANY WITH GUN
Present 236 (* gun is here *) 
NOUNIsCreature 
NOUNPresent
PrintMessage 57 (* you kill it bloodily *) 
MakeVarRoomNum 25 (* save room number in temp. variable *)
GoToRoom 199 (* temp. go to irrelevant room *)
DestroyNOUN  (* kill the creature: bug manifests in irrelevant room *)
GoToVariableRoom 25 (* pop back to original room *)
TurnFlagON 107 (* no bullet left *)
DoneWithTurn
END_COMMAND

COMMAND ATTACK SKELETONS WITH SWORD
PrintMessage 63 (* can only get one *)
DoneWithTurn
END_COMMAND

COMMAND ATTACK LORD WITH SWORD
Present 254 (* sword is here *) 
NOUNIsCreature 
NOUNPresent
PrintMessage 60 (* you kill it bloodily *) 
SwapLocations 309 256  (* troll lord --> fragments *)
TurnCounterOFF 10  (* There is no hostile in room now *)
TurnCounterON 7 (* Cindy fully charged *)
TurnCounterON 8  (* troll lord starts regenerating *)
DoneWithTurn
END_COMMAND

COMMAND ATTACK FRAGMENTS WITH SWORD
Present 254  (* sword is here *)
NOUNPresent
PrintMessage 193  (* you pound some more on the troll lord bits *)
TurnCounterON 8  (* reset troll lord regeneration to beginning *)
DoneWithTurn
END_COMMAND

COMMAND ATTACK DEMIGOD WITH SWORD
Present 254  (* sword is here *)
NOUNPresent  (* demigod is here *)
PrintMessage 101  (* sorry... you die *)
Destroy 254  (* and sword is destroyed *)
ReDirectTo KILL_ALL
END_COMMAND  (* Tark eventually killed or whatever too *)

COMMAND ATTACK MYSELF WITH SWORD
Present 254  (* sword is here *)
PrintMessage 93  (* you do it -- hear cindy screaming *)
Destroy 254  (* sword disappears *)
PutInCurrentRoom 310 (* to be replaced by Cindy, free *)
Destroy 214 (* Get rid of Cindy-not-here message in dining area *)
PlusScore 10  (* worth ten points *)
ReDirectTo KILL_PLAYER
END_COMMAND  (* and then Phil dies *)

COMMAND ATTACK ANY WITH SWORD
Present 254 (* sword is here *) 
NOUNIsCreature 
NOUNPresent
PrintMessage 60 (* you kill it bloodily *) 
MakeVarRoomNum 25 (* save room number in temp. variable *)
GoToRoom 199 (* temp. go to irrelevant room *)
DestroyNOUN  (* kill the creature: bug manifests in irrelevant room *)
GoToVariableRoom 25 (* pop back to original room *)
TurnCounterON 7 (* Cindy fully charged *)
DoneWithTurn
END_COMMAND

COMMAND ATTACK FRAGMENTS
NOUNPresent
PrintMessage 192  (* can't make headway *)
DoneWithTurn
END_COMMAND

COMMAND ATTACK LOCK
Present 269  (* flesh lock *)
PrintMessage 194  (* no effect *)
DoneWithTurn
END_COMMAND

COMMAND ATTACK ANY
ObjectIsNumber 0  (* no weapon specified *)
PrintMessage 76  (* with what? *)
DoneWithTurn
END_COMMAND

COMMAND SHOOT ANY
NOT NOUNIsNumber 236 (* not SHOOT GUN *)
ObjectIsNumber 0  (* no weapon specified *)
PrintMessage 76  (* with what? *)
DoneWithTurn
END_COMMAND

COMMAND ANYBODY, AWAY ANY 
NAMEIsNumber 300  (* Tark, ... *)
Present 300  (* Tark is here *)
NOT Present 204  (* no gold cross *)
PrintMessage 74  (* sorry *)
DoneWithTurn
END_COMMAND

COMMAND ANYBODY, AWAY SKELETONS
NAMEIsNumber 300  (* Tark, ... *)
Present 300  (* Tark is here *)
Present 308  (* animated skeletons here *)
PrintMessage 64  (* Tark aways; note anti-magic shell *)
Destroy 308  (* get rid of them *)
TurnCounterOFF 10  (* There is no hostile in room now *)
DoneWithTurn
END_COMMAND

COMMAND ANYBODY, AWAY SKELETONS
NAMEIsNumber 300  (* Tark, ... *)
Present 300  (* Tark is here *)
Present 201  (* your converted-undead friends are here *)
PrintMessage 65  (* you waste them *)
Destroy 201
DoneWithTurn
END_COMMAND

COMMAND ANYBODY, AWAY DEMONESS
NAMEIsNumber 300  (* Tark, ... *)
Present 300  (* Tark is here *)
NOUNPresent
PrintMessage 160  (* she's unimpressed *)
DoneWithTurn
END_COMMAND

COMMAND ANY
CounterEquals 10 0  (* we're not counting time spent with hostile *)
Present 308  (* animated skeletons here *)
OR
Present 309  (* or troll lord is here *)
OR
Present 311  (* or demigod is here *)
OR
Present 312  (* demoness is here and not feeling amorous *)
OR
Present 314  (* guard is here *)
TurnCounterON 10  (* start counting *)
END_COMMAND

COMMAND ANY
NOT Present 308  (* animated skeletons not here *)
NOT Present 309  (* nor troll lord *)
NOT Present 311  (* nor demigod *)
NOT Present 312  (* nor unamorous demoness *)
NOT Present 314  (* nor guard *)
TurnCounterOFF 10  (* stop "hostile present" counter *)
END_COMMAND

COMMAND ANY
CounterGT 10 2  (* He's had 2.5 chances with a hostile *)
Present 308  (* specifically, the animated skeletons *)
PrintMessage 96  (* they kill you *)
ReDirectTo KILL_PLAYER
END_COMMAND  (* you die *)

COMMAND ANY
CounterGT 10 2  (* He's had 2.5 chances with a hostile *)
Present 309  (* specifically, the troll lord *)
PrintMessage 97  (* it kills you *)
ReDirectTo KILL_PLAYER
END_COMMAND  (* you die *)

COMMAND ANY
CounterGT 10 2  (* He's had 2.5 chances with a hostile *)
Present 312  (* specifically, the unamorous demoness *)
PrintMessage 153  (* you have no mouth but must scream *)
GoToRoom 198 (* despair *)
DoneWithTurn
END_COMMAND  (* you die *)

COMMAND ANY
CounterGT 10 2  (* He's had 2.5 chances with a hostile *)
Present 314  (* specifically, the guard *)
PrintMessage 159  (* it kills you *)
ReDirectTo KILL_ALL
END_COMMAND  (* you die *)

COMMAND ANY
CounterEquals 10 1  (* He's had 1 chance with a hostile *)
Present 311  (* specifically, the demigod *)
PrintMessage 102   (* it screeches and conjures *)
END_COMMAND

COMMAND ANY
CounterEquals 10 2  (* He's had 2 chance with a hostile *)
Present 311  (* specifically, the demigod *)
PrintMessage 105   (* it continues to conjures *)
END_COMMAND

COMMAND ANY
CounterGT 10 2  (* He's had 2.5 chances with a hostile *)
Present 311  (* specifically, the demigod *)
PrintMessage 103  (* it binds you for eternity *)
TurnCounterOFF 10  (* no hostiles anymore *)
GoToRoom 196  (* eternity -- no escape *)
TurnFlagON 255  (* temp. flag -- finish the turn *)
IsSomewhere 310  (* IF ... Cindy is still alive somehwere *)
OR
IsSomewhere 254  (*      e.g. as a sword *) 
OR
FlagON 101       (*      e.g. as a picture *)
OR
FlagON 103       (*      e.g. as a statue  *)
TurnFlagOFF 255
PrintMessage 104  (* THEN ... he tortures her once in awhile *)
DoneWithTurn
END_COMMAND  (* you die *)

COMMAND ANY
FlagON 255   (* ... ELSE just finish turn *)
TurnFlagOFF 255
DoneWithTurn
END_COMMAND

(*** Cops pull up first time you're outside castle ***)

COMMAND ANY
AtLocation 24  (* outside castle *)
FlagOFF 3 (* first time here *)
TurnFlagON 3 (* OK -- you've been here now *)
PrintMessage 17  (* cops pull up *)
PutInCurrentRoom 230  (* squad car here now *)
PutInCurrentRoom 304  (* police officers here now *)
DoneWithTurn  (* interrupted whatever was planned *)
END_COMMAND


(*** Miscellaneous commands for Phil's house ***)

COMMAND EXAMINE ME
DescribeThing 226  (* Phil *)
DoneWithTurn
END_COMMAND

COMMAND TAKE NOTEBOOK
NOUNPresent
PrintMessage 177  (* you can't, it's fixed in the aether *)
DoneWithTurn
END_COMMAND

COMMAND TAKE ALL
Present 200  (* dnd notebook *)
PrintMessage 177  (* you can't take notebook, it's fixed in the aether *)
END_COMMAND  (* fall through to AGT to take everything movable *)

COMMAND SOUTH
AtLocation 4  (* Living Room --> Bottom of the Sea *)
PrintMessage 95  (* you drown *)
ReDirectTo KILL_ALL
END_COMMAND  (* you die *)

COMMAND SOUTH
AtLocation 11 (* Phil's garage *)
InRoom 302 (* fire elemental is present *)
PrintMessage 1 (* it blocks your way *)
DoneWithTurn
END_COMMAND

COMMAND EXAMINE SKELETONS
Present 201 (* friends' skeletons are here *)
PutInCurrentRoom 204  (* Paul's gold cross now available *)
END_COMMAND

COMMAND EXAMINE WATER
Present 208  (* burst pipe and water in garage *)
NOT Present 216  (* some water aquired elsewhere *)
NOT Present 217  (* holy water *)
ReDirectTo EXAMINE PIPE
END_COMMAND

(*** Commands to handle television ***)

COMMAND TURN TELEVISION
NOUNPresent
FlagOFF 12  (* television off *)
FlagOFF 13  (* tv never tried before *)
PrintMessage 169  (* see Rhom *)
TurnFlagON 12  (* tv on now *)
TurnFlagON 13  (* and he's seen Rhom now *)
DoneWithTurn
END_COMMAND

COMMAND TURN TELEVISION
NOUNPresent
FlagOFF 12  (* tv off *)
FlagON 13  (* tv tried before *)
PrintMessage 170  (* static *)
TurnFlagON 12  (* tv on now *)
DoneWithTurn
END_COMMAND

COMMAND TURN TELEVISION
NOUNPresent
FlagON 12  (* tv on *)
PrintMessage 171  (* you turn it off *)
TurnFlagOFF 12  (* tv off now *)
DoneWithTurn
END_COMMAND


(*** Need to dig to get to Phil's guest bathroom *)

COMMAND USE SHOVEL
ReDirectTo DIG WITH SHOVEL
END_COMMAND

COMMAND DIG ANY
AtLocation 12  (* small hall area with dirt *)
NOT Present 212  (* no passage dug here *)
Present 205  (* shovel in room or carried *)
PrintMessage 2 (* you dig ... *)
PutInCurrentRoom 212  (* put dug passage here *)
ChangePassageway 1 14 (* allow movement to guest bathroom *)
DoneWithTurn
END_COMMAND

COMMAND DIG ANY
AtLocation 12  (* in small hall area with dirt *)
NOT Present 205 (* no shovel *)
PrintMessage 3 (* no luck *)
DoneWithTurn
END_COMMAND

COMMAND DIG ANY
PrintMessage 4 (* you dig ineffectually *)
DoneWithTurn
END_COMMAND


(*** Need to flush guest toilet to flood garage and kill fire elemental ***)

COMMAND USE TOILET
ReDirectTo FLUSH TOILET
END_COMMAND

COMMAND FLUSH TOILET
AtLocation 14  (* guest bathroom *)
Destroy 302  (* fire elemental in garage is killed *)
SendToRoom 208 11  (* put burst-pipe/water in garage *)
PrintMessage 5  (* you here screeching ... *)
PlusScore 10  (* worth ten points *)
DoneWithTurn
END_COMMAND

COMMAND FLUSH TOILET
AtLocation 8  (* master bathroom *)
PrintMessage 6  (* toilet flushes *)
DoneWithTurn
END_COMMAND


(*** Jumping off the cliff in Phil's back yard kills you. ***)

COMMAND NORTH
AtLocation 10  (* back yard *)
ReDirectTo JUMP
END_COMMAND

COMMAND DOWN
AtLocation 10  (* back yard *)
ReDirectTo JUMP
END_COMMAND

COMMAND JUMP
AtLocation 10  (* back yard *)
PrintMessage 164  (* you fall forever *)
ReDirectTo KILL_PLAYER
END_COMMAND 


(*** Some commands for examining Tark and Phil. ***)

COMMAND EXAMINE TARK
FlagON 105  (* Tark is male. *)
PrintMessage 183  (* " *)
END_COMMAND

COMMAND EXAMINE TARK
FlagON 110  (* Tark is a eunich *)
PrintMessage 184  (* " *)
END_COMMAND

REM  Following yields "What any?" error when drops to AGT processing.
REM 
REM  COMMAND EXAMINE ME
REM  ReDirectTo INVENTORY
REM  END_COMMAND

COMMAND INVENTORY
FlagON 106  (* Phil is female *)
PrintMessage 185 (* " *)
END_COMMAND

COMMAND INVENTORY
FlagON 109  (* Phil is a eunich *)
PrintMessage 186 (* " *)
END_COMMAND

COMMAND INVENTORY
FlagON 108  (* Phil has tatoos *)
PrintMessage 187 (* " *)
END_COMMAND


(*** Tark's nakedness -- she must be robed outside or police get her ***)

COMMAND ANY
AtLocation 20 (* Front of Phil's House *)
Present 300 (* Tark is here *)
FlagOFF 1 (* Tark is naked *)
PrintMessage 9 (* Police come and haul you away *)
ReDirectTo KILL_ALL
END_COMMAND  (* death *)

COMMAND EXAMINE TARK
Present 300  (* Tark is here *)
FlagOFF 1  (* Tark is naked *)
PrintMessage 19  (* give naked Tark description *)
END_COMMAND  (* drop to normal examine text *)

COMMAND EXAMINE TARK
Present 300  (* Tark is here *)
FlagON 1  (* Tark is robed *)
PrintMessage 20  (* give robed Tark description *)
END_COMMAND  (* drop to normal examine text *)

COMMAND ANYBODY, TAKE ROBE
NAMEIsNumber 300  (* TARK, TAKE ROBE *)
ReDirectTo ANYBODY, WEAR ROBE
END_COMMAND

COMMAND ANYBODY, WEAR ROBE
NAMEIsNumber 300  (* TARK, WEAR ROBE *)
Present 202  (* robe is present *)
Present 300  (* Tark is here too *)
TurnFlagON 1  (* Tark is now robed *)
Destroy 202 (* get rid of robe *)
PrintMessage 7 (* Tark puts on robe *)
DoneWithTurn
END_COMMAND


(*** Tark spells ***)

COMMAND ANYBODY, CONJURE CURSE
Present 300  (* Tark is here *)
PrintMessage 45  (* Tark chastizes *)
DoneWithTurn  (* nothing comes of it *)
END_COMMAND

COMMAND ANYBODY, CONJURE RESIST COLD ON ME
NAMEIsNumber 300  (* TARK, ... *)
Present 300  (* Tark is here *)
TurnCounterON 2  (* Phil is resisting cold *)
PrintMessage 25  (* Tark conjures successfully; feel warmth *)
DoneWithTurn
END_COMMAND

COMMAND ANYBODY, CONJURE RESIST COLD ON TARK
NAMEIsNumber 300  (* TARK, ... *)
Present 300  (* Tark is here *)
TurnCounterON 3  (* Tark is resisting cold *)
PrintMessage 22  (* Tark conjures successfully *)
DoneWithTurn
END_COMMAND

COMMAND ANYBODY, CONJURE RESIST COLD ON ANY
NAMEIsNumber 300  (* TARK, ... *)
ObjectIsNumber 0  (* No object specified *)
Present 300 (* Tark is here *)
PrintMessage 173 (* Cast on whom? *)
DoneWithTurn
END_COMMAND

COMMAND ANYBODY, CONJURE RESIST COLD ON ANY
NAMEIsNumber 300  (* TARK, ... *)
Present 300 (* Tark is here *)
PrintMessage 24 (* Tark doesn't want to. *)
DoneWithTurn
END_COMMAND

COMMAND ANY
CounterGT 2 50  (* Phil's Resist Cold is up *)
TurnCounterOFF 2  (* get rid of it *)
PrintMessage 26 (* warmth goes away *)
END_COMMAND

COMMAND ANY
CounterGT 3 50  (* Tark's Resist Cold is up *)
TurnCounterOFF 3  (* get rid of it *)
END_COMMAND  (* no message *)

COMMAND ANYBODY, CONJURE LIGHT
NAMEIsNumber 300  (* TARK, ... *)
NAMEPresent  (* Tark is here *)
AtLocation 71
OR
AtLocation 72  (* in Torture room/ prison cell area *)
SendToRoom 291 71  (* put light in room torture room *)
SendToRoom 292 72  (* .. and spilling into prison cell *)
TurnCounterON 4  (* keep track of how long it lasts *)
PrintMessage 46  (* light appears *)
LookAtRoom  (* Print room description now *)
DoneWithTurn
END_COMMAND

COMMAND ANYBODY, CONJURE LIGHT
NAMEIsNumber 300  (* TARK, ... *)
NAMEPresent  (* Tark is here *)
AtLocation 73
OR
AtLocation 74  (* in vat room / storage room area *)
SendToRoom 293 73  (* put some light in vat room *)
SendToRoom 294 74  (* .. and spilling into storage room *)
TurnCounterON 5  (* keep track of how long it lasts *)
PrintMessage 46  (* light appears *)
LookAtRoom  (* Print room description now *)
DoneWithTurn
END_COMMAND

COMMAND ANY
CounterGT 4 20  (* torture room/ prison cell light expired *)
TurnCounterOFF 4  (* kill it *)
Destroy 291  (* get rid of meta-lights *)
Destroy 292
END_COMMAND

COMMAND ANY
CounterGT 5 20  (* vat room/ storage room light expired *)
TurnCounterOFF 5  (* kill it *)
Destroy 293  (* get rid of meta-lights *)
Destroy 294
END_COMMAND

COMMAND ANYBODY, CONJURE LIGHT
NAMEIsNumber 300  (* TARK, ... *)
NAMEPresent  (* Tark is here *)
PrintMessage 47  (* you can already see here *)
DoneWithTurn
END_COMMAND

COMMAND ANY
Present 306  (* uncharmed snakes here *)
PrintMessage 49  (* they kill you *)
ReDirectTo KILL_PLAYER
END_COMMAND  (* death *)

COMMAND ANYBODY, CONJURE SNAKE CHARM
NAMEIsNumber 300  (* TARK, ... *)
Present 300  (* Tark is here *)
AtLocation 71  (* in torture room or prison cell *)
OR
AtLocation 72
PrintMessage 48  (* snakes under control *)
SwapLocations 306 307  (* swap active snakes with charmed snakes *)
TurnCounterON 6  (* keep track of how long spell lasts *)
DoneWithTurn
END_COMMAND

COMMAND ANYBODY, CONJURE SNAKE CHARM
Present 300  (* Tark is here *)
PrintMessage 51  (* what snakes? -- last cmd didn't take over *)
DoneWithTurn
END_COMMAND

COMMAND ANY
CounterGT 6 10  (* Snake Charm run out *)
SwapLocations 306 307  (* switch charmed and uncharmed snakes *)
TurnCounterOFF 6  (* spell is over *)
END_COMMAND

COMMAND TAKE SNAKES
Present 307  (* Charmed snakes are here *)
PrintMessage 50  (* Tark forbids it 'cause they're evil *)
Destroy 307  (* and kills the snakes to score her point *)
DoneWithTurn
END_COMMAND

COMMAND ANYBODY, CONJURE ANY
NAMEIsNumber 300  (* TARK, ... *)
Present 300  (* Tark is here *)
PrintMessage 23  (* Tark conjures unsuccessfully *)
DoneWithTurn
END_COMMAND


(*** Miscellaneous commands for outside ***)

COMMAND NORTHWEST
AtLocation 20 (* driveway --> front porch *)
FlagOFF 2 (* haven't tried front door from porch yet *)
PrintMessage 10 (* things seem familiar and comfortable here *)
END_COMMAND

COMMAND NORTH
AtLocation 21  (* front porch --> front door *)
FlagOFF 2 (* haven't tried front door from porch yet *)
PrintMessage 11  (* your hand passes through the door *)
TurnFlagON 2 (* now he's tried it *)
DoneWithTurn (* don't move from front porch *)
END_COMMAND

COMMAND NORTH
AtLocation 21 (* front porch --> front door *)
PrintMessage 12 (* you walk through to ... the front porch! *)
END_COMMAND

COMMAND TALK TO SURVIVALISTS
Present 303  (* survivalists here *)
PrintMessage 15  (* fuck off *)
DoneWithTurn
END_COMMAND

COMMAND TALK TO OFFICERS
Present 304 (* officers here *)
PrintMessage 16 (* you'd better move on, sir *)
DoneWithTurn
END_COMMAND

COMMAND EXAMINE MAN
Present 230  (* squad car *)
PrintMessage 176  (* handcuffed in back seat *)
DoneWithTurn
END_COMMAND

COMMAND TALK TO MAN
Present 230  (* squad car *)
IsOpen 230  (* squad car *)
PrintMessage 165  (* ok, but nothing important *)
DoneWithTurn
END_COMMAND

COMMAND TALK TO MAN
Present 230  (* squad car *)
NOT IsOpen 230  (* squad car *)
PrintMessage 166  (* can't hear through window *)
DoneWithTurn
END_COMMAND

COMMAND OPEN DOOR
Present 230  (* squad car is here *)
ReDirectTo OPEN CAR
END_COMMAND  (* then door means car door *)

COMMAND ENTER CAR
ReDirectTo OPEN CAR
END_COMMAND

COMMAND OPEN CAR
Present 230  (* the squad car is here *)
PrintMessage 18  (* you open the front door *)
OpenIt 230  (* open the squad car *)
DoneWithTurn
END_COMMAND

COMMAND EXAMINE BODY
Present 235  (* it's the dead survivalist *)
PutInCurrentRoom 236 (* Phil's found the gun *)
PutInCurrentRoom 237 (*   and twinkie *)
END_COMMAND


(*** Commands relating to Cindy in the mud-house: must say "you are free"
     to release her.  You cannot approach her since otherwise you could
     easily get her hair for the recipe.  When released, she fades to next
     binding.                                                          ***)

COMMAND TALK TO CINDY
AtLocation 54 (* mud-house *)
ReDirectTo EXAMINE CINDY
END_COMMAND

COMMAND TOUCH CINDY
ReDirectTo TAKE CINDY
END_COMMAND

COMMAND TAKE CINDY
Present 305  (* Cindy, trapped in mud-house *)
PrintMessage 172  (* you can't get to her *)
DoneWithTurn
END_COMMAND

COMMAND CINDY, YOU ARE FREE
ReDirectTo YOU ARE FREE
END_COMMAND

COMMAND YOU ARE FREE
AtLocation 54  (* in mud-house *)
Destroy 305  (* get rid of mud-house Cindy *)
TurnFlagON 101  (* Cindy is now an undiscovered picture *)
PrintMessage 21
PlusScore 10  (* worth ten points *)
DoneWithTurn
END_COMMAND


(*** Commands to handle castle gate.  Everyone must be Resist Cold'ed to
     survive cold trap.  Phil passes out and Tark takes him inside.    ***)

COMMAND ENTER
AtLocation 26 (* castle gate *)
RedirectTo NORTH
END_COMMAND

COMMAND NORTH
AtLocation 26 (* castle gate *)
CounterGT 2 0 (* Phil has Resist Cold *)
NOT CounterGT 3 0 (* Tark does not *)
PrintMessage 27 (* yo, fool, what about me? *)
DoneWithTurn
END_COMMAND

COMMAND NORTH
AtLocation 26 (* castle gate *)
NOT CounterGT 2 0 (* Phil does not have Resist Cold *)
PrintMessage 28 (* you die *)
ReDirectTo KILL_PLAYER
END_COMMAND (* death *)

COMMAND NORTH
AtLocation 26 (* castle gate *)
CounterGT 2 0 (* Phil has Resist Cold *)
CounterGT 3 0 (* Tark does too *)
PrintMessage 29 (* pass out -- Tark takes you through *)
GoToRoom 52 (* Have to hide out in East Guard Room to conjure Heal *)
DoneWithTurn
END_COMMAND


(*** Entering the room with the guards kill you. ***)

COMMAND WEST
AtLocation 50  (* Entrance Hall --> West Guard Room *)
PrintMessage 94  (* the guards kill you *)
ReDirectTo KILL_ALL
END_COMMAND  (* you die *)


(*** Commands to handle Cindy as a statue.  Cindy must be kissed by a
     good, male cleric to be freed leading to a love geas between her
     and the cleric.  Then she fades to next binding.  If he's examined
     the statues once, and passes by them again, we give him a hint if
     Cindy has since appeared there.                                ***)

COMMAND EXAMINE STATUES
AtLocation 55  (* in statue gallery *)
FlagON 103  (* Cindy is a statue *)
PrintMessage 30 (* you find cindy statue *)
PutInCurrentRoom 245  (* Put Cindy statue here *)
TurnFlagOFF 104  (* nothing out-of-place here anymore *)
DoneWithTurn  (* skip normal description *)
END_COMMAND

COMMAND EXAMINE STATUES
AtLocation 55  (* in statue gallery *)
FlagOFF 103  (* Cindy is not a statue *)
TurnFlagON 104  (* statues examined before Cindy was here *)
END_COMMAND  (* go on to normal description *)

COMMAND ANY
AtLocation 55  (* in statue gallery *)
FlagON 104   (* statues examined before Cindy was here *)
FlagON 103   (* Cindy is a statue *)
PrintMessage 40  (* something is odd here *)
END_COMMAND

COMMAND ANYBODY, KISS CINDY
AtLocation 55  (* Statue Gallery *)
RedirectTo ANYBODY, KISS STATUE
END_COMMAND

COMMAND ANYBODY, KISS STATUE
AtLocation 55  (* Statue Gallery *)
FlagON 103  (* Cindy is a statue *)
NAMEIsNumber 300  (* TARK, KISS STATUE *)
FlagOn 105  (* Tark is male *)
PrintMessage 31  (* Cindy freed *) 
Destroy 245  (* remove Cindy statue *)
TurnFlagOFF 103  (* Cindy no longer a statue *)
SendToRoom 254 91  (* Put Cindy-sword in black god room *)
PlusScore 10  (* worth ten points *)
DoneWithTurn
END_COMMAND 


COMMAND ANYBODY, KISS STATUE
AtLocation 55  (* Statue Gallery *)
FlagON 103  (* Cindy is a statue *)
FlagOFF 105  (* Tark is male *)
PrintMessage 32 (* no apparent effect *)
DoneWithTurn
END_COMMAND 

COMMAND KISS CINDY
AtLocation 55  (* Statue Gallery *)
ReDirectTo KISS STATUE
END_COMMAND

COMMAND KISS CINDY
Present 310  (* freed Cindy is here *)
PrintMessage 108  (* you do! *)
DoneWithTurn
END_COMMAND

COMMAND KISS STATUE
AtLocation 55  (* Statue Gallery *)
FlagON 103  (* Cindy is a statue *)
PrintMessage 33  (* no apparent effect *)   
DoneWithTurn
END_COMMAND 


(*** Commands to handle Cindy as a picture.  The correct stud on the
     frame must be pressed to release her.  Then she fades to next binding.
     If he's examined the pictures once, and passes by them again, we give
     him a hint if Cindy has since appeared there.                      ***)


COMMAND EXAMINE PAINTING
ReDirectTo EXAMINE PAINTINGS
END_COMMAND

COMMAND EXAMINE PAINTINGS
Present 246  (* The paintings are here. *)
FlagOFF 101  (* Cindy is not a picture. *)
PrintMessage 34  (* paintings, no Cindy *)
TurnFlagON 102  (* picture examined before Cindy discovered *)
DoneWithTurn
END_COMMAND

COMMAND EXAMINE PAINTINGS
Present 246  (* The paintings are here. *)
FlagON 101  (* Cindy is a picture. *)
PrintMessage 34  (* paintings ... *)
PrintMessage 35  (* ... and Cindy *)
PutInCurrentRoom 247  (* put Cindy painting here *)
TurnFlagOFF 102  (* nothing out-of-place here anymore *)
DoneWithTurn
END_COMMAND

COMMAND ANY
Present 246  (* The paintings are here. *)
FlagON 102   (* pictures examined before Cindy was here *)
FlagON 101   (* Cindy is a picture. *)
PrintMessage 39
END_COMMAND

COMMAND PRESS STUD
Present 246  (* The paintings are here *)
FlagON 101  (* Cindy is a painting *)
AskQuestion 1  (* which stud? *)
TurnFlagON 255 (* temporary flag to test correctness of answer *)
AnswerIsCorrect (* he pushed the correct stud *)
TurnFlagOFF 255 (* turn flag off 'cause answer correct *)
PrintMessage 36  (* you free Cindy *)
Destroy 247  (* get rid of Cindy painting *)
TurnFlagOFF 101  (* Cindy no longer a painting *)
TurnFlagON 103  (* Cindy is now a statue *)
PlusScore 10  (* worth ten points *)
DoneWithTurn
END_COMMAND

COMMAND PRESS STUD
FlagON 255  (* He pushed the wrong stud on Cindy painting *)
TurnFlagOFF 255 (* done with temp. flag *)
PrintMessage 37  (* a trap... you die *)
ReDirectTo KILL_PLAYER
END_COMMAND (* death *)

COMMAND PRESS STUD
Present 246  (* The paintings are here *)
FlagOFF 101  (* Cindy is not a painting *)
PrintMessage 38  (* nothing happens *)
DoneWithTurn
END_COMMAND


(*** Commands to handle sex-change door which Tark must enter before her
     kiss can release the Cindy-statue.                               ***)

COMMAND ANYBODY, ENTER DOOR
AtLocation 82 (* sex-change room *)
ReDirectTo ANYBODY, ENTER
END_COMMAND

COMMAND ANYBODY, ENTER
AtLocation 82 (* sex-change room *)
NAMEIsNumber 300  (* Tark, ... *)
Present 300 (* Tark is here *)
FlagOFF 105 (* Tark is still female *)
PrintMessage 41 (* Tark becomes male *)
TurnFlagON 105 (* Tark is now male *)
DoneWithTurn
END_COMMAND

COMMAND ANYBODY, ENTER
AtLocation 82 (* sex-change room *)
NAMEIsNumber 300  (* Tark, ... *)
FlagON 105 (* Tark is already male *)
PrintMessage 43 (* nothing happens *)
DoneWithTurn
END_COMMAND

COMMAND ENTER DOOR
AtLocation 82  (* sex-change room *)
ReDirectTo ENTER
END_COMMAND

COMMAND USE DOOR
ReDirectTo ENTER DOOR
END_COMMAND

COMMAND ENTER
AtLocation 82 (* sex-change room *)
FlagOFF 106 (* Phil is still male *)
PrintMessage 42 (* Phil becomes female *)
TurnFlagON 106 (* Phil is now female *)
DoneWithTurn
END_COMMAND

COMMAND ENTER
AtLocation 82  (* in sex-change room *)
FlagON 106  (* Phil is already female *)
PrintMessage 43 (* nothing happens *)
DoneWithTurn
END_COMMAND

(*** Eating various things: paisley Cake, Skullcap ***)

COMMAND EAT PAISLEY CAKE
NOUNPresent  (* it's here *)
Present 310  (* Cindy is here *)
PrintMessage 143  (* you go crazy and make it with Cindy *)
END_COMMAND

COMMAND EAT PAISLEY CAKE
NOUNPresent  (* it's here *)
Present 300  (* Tark is here *)
PrintMessage 44  (* you go crazy and make it with Tark *)
END_COMMAND

COMMAND EAT PAISLEY CAKE
NOUNPresent  (* it's here *)
NOT Present 300  (* Tark is not here *)
NOT Present 110 (* Cindy is not here *)
PrintMessage 144  (* you go crazy *)
RedirectTo KILL_PLAYER
END_COMMAND

COMMAND EAT PAISLEY CAKE
NOUNPresent 
DestroyNOUN
AtLocationGT 50 (*inside castle*) 
PrintMessage 145 (* you die *)
RedirectTo KILL_ALL
END_COMMAND

COMMAND EAT PAISLEY CAKE
DoneWithTurn  (* Phil wasn't killed above *)
END_COMMAND

COMMAND EAT SKULLCAP
NOUNPresent
DestroyNOUN
PrintMessage 146  (* strange ... *)
DoneWithTurn
END_COMMAND


(*** Picking up the Cindy sword -- if the first time, we must initialize
     the counter which measures her health.  She must kill things to be
     fed.                                                            ***)

COMMAND TAKE SWORD
InRoom 254  (* Cindy sword is here. *)
PrintMessage 52 (* hand thrills to touch *)
CounterEquals 7 0  (* Phil never picked up sword before *)
TurnCounterON 7  (* Start 'bleeding' counter *)
END_COMMAND  (* drop through to AGT to pick up sword *)

COMMAND TAKE ALL
InRoom 254  (* Cindy sword is here. *)
PrintMessage 52 (* hand thrills to touch *)
CounterEquals 7 0  (* Phil never picked up sword before *)
TurnCounterON 7  (* Start 'bleeding' counter *)
END_COMMAND (* fall through to take everything *)


(*** Mythril door in troll room is illusionary and must be disbelieved.
     Throwing things at it generates an illusion that they are destroyed
     when they actually fall into next room.                         ***)

COMMAND DISBELIEVE DOOR
AtLocation 83 (* troll room*)
PrintMessage 61  (* Door becomes translucent *)
ChangePassageway 2 84 (* Can now move south to stronghold *)
PutInCurrentRoom 255 (* translucent door *)
TurnFlagON 116  (* door now "open" *)
DoneWithTurn
END_COMMAND

COMMAND DISBELIEVE DOOR
PrintMessage 62  (* sorry, it's real *)
DoneWithTurn
END_COMMAND

COMMAND DISBELIEVE
NOUNIsNumber 0  (* no noun specified *)
PrintMessage 66  (* disbelieve what? *)
DoneWithTurn
END_COMMAND

COMMAND DISBELIEVE ANY
PrintMessage 62 (* sorry, it's real*)  
DoneWithTurn
END_COMMAND

COMMAND EXAMINE DOOR
Present 255  (* translucent door *)
DescribeThing 255  (* translucent door *)
DoneWithTurn
END_COMMAND

COMMAND THROW ANY AT DOOR
AtLocation 83  (* troll room *)
NOUNPresent
NOT NOUNIsCreature  (* can't throw Tark or troll lord *)
PrintMessage 72  (* it disappears in a flash *)
SendNOUNToRoom 91  (* but really falls into Outer Room *)
DoneWithTurn
END_COMMAND

COMMAND PICK LOCK
PrintMessage 98  (* you can't *)
DoneWithTurn
END_COMMAND


(*** Commands that deal with walking into anti-magic shell around
     stronghold.  Neither Cindy-sword nor the scroll can enter there.
     Anyone who has magically had their sex changed becomes a eunich. ***)

COMMAND SOUTH
AtLocation 84 (* Outer room -> Iron Door *)
IsCarrying 254 (* Cindy sword *)
PrintMessage 67 (* Cindy sword dies *)
GoToRoom 198 (* Despair*)
DoneWithTurn
END_COMMAND

COMMAND SOUTH
AtLocation 84  (* Outer room --> Iron door *)
FlagON 106  (* female Phil enters anti-magic shell *)
PrintMessage 89  (* ouch! *)
TurnFlagOFF 106  (* Phil is no longer female *)
TurnFlagON 109  (* he is now a eunich *)
END_COMMAND

COMMAND SOUTH
AtLocation 84  (* Outer room --> Iron door *)
FlagON 105  (* male Tark enters anti-magic shell *)
PrintMessage 90  (* ouch! for Tark *)
TurnFlagOFF 105  (* Tark is no longer male *)
TurnFlagON 110  (* she is now a eunich *)
END_COMMAND

COMMAND SOUTH
AtLocation 84  (* outer room --> iron door *)
IsCarrying 257  (* troll flesh *)
PrintMessage 91  (* hear a soft pop from possessions *)
SwapLocations 257 278  (* troll flesh --> dead troll flesh *)
END_COMMAND

COMMAND SOUTH
AtLocation 84  (* outer room --> iron door *)
IsCarrying 252  (* troll box *)
IsLocated 257 252  (* troll flesh is in troll box *)
PrintMessage 91  (* hear a soft pop from possessions *)
SwapLocations 257 278  (* troll flesh --> dead troll flesh *)
END_COMMAND

COMMAND NORTH
AtLocation 93  (* stronghold --> iron door *)
IsCarrying 259  (* emergency scroll enters anti-magic shell *)
PrintMessage 91  (* hear a soft pop from possessions *)
SwapLocations 259 261  (* scroll --> blank scroll *)
END_COMMAND


(*** To get through the stronghold door, the lock must be drilled out.
     Note: door is synonymous with lock.                             ***)

COMMAND DRILL DOOR
ReDirectTo DRILL LOCK
END_COMMAND

COMMAND DRILL LOCK
FlagON 115  (* drill bits are ruined *)
PrintMessage 142  (* sorry *)
DoneWithTurn
END_COMMAND

COMMAND DRILL LOCK
AtLocation 92 (* Iron Door *)
Present 213 (* power drill *)
PrintMessage 68
ChangePassageway 2 93 (* south door to Stronghold *)
ChangePassageway 11 93 (* or ENTER there *)
TurnFlagON 115  (* drill bits now ruined *)
TurnFlagON 117  (* door now "open" *)
DoneWithTurn
END_COMMAND

COMMAND DRILL LOCK
AtLocation 83 (* troll room *)
Present 213 (* power drill *)
PrintMessage 69  (* Drilling doesn't work *)
DoneWithTurn
END_COMMAND

REM  No longer taken as valid syntax:
REM
REM  COMMAND SHOOT GUN AT LOCK
REM  ReDirectTo SHOOT DOOR WITH GUN
REM  END_COMMAND

COMMAND SHOOT LOCK WITH GUN
ReDirectTo SHOOT DOOR WITH GUN
END_COMMAND

COMMAND SHOOT GUN AT DOOR
ReDirectTo SHOOT DOOR WITH GUN
END_COMMAND

COMMAND SHOOT DOOR WITH GUN
AtLocation 83 (* troll room *)
Present 213  (* gun is here *)
FlagOFF 107  (* bullet left in gun *)
PrintMessage 70  (* door not scratched *)
TurnFlagON 107  (* bullet gone now *)
DoneWithTurn
END_COMMAND

COMMAND SHOOT DOOR WITH GUN
AtLocation 92  (* iron door *)
Present 213  (* gun is here *)
FlagOFF 107  (* bullet left in gun *)
PrintMessage 71  (* door scratched but not opened *)
TurnFlagON 107  (* bullet gone now *)
DoneWithTurn
END_COMMAND

COMMAND SHOOT DOOR WITH GUN
Present 269  (* flesh lock *)
Present 213  (* gun is here *)
FlagOFF 107  (* bullet left in gun *)
PrintMessage 195  (* bullet passes through lock *)
TurnFlagON 107  (* bullet gone now *)
DoneWithTurn
END_COMMAND


(***  Using key in various situations with various synonyms  ***)

COMMAND OPEN LOCK WITH ANY
AtLocation 83  (* troll room *)
OR
AtLocation 92  (* iron door *)
OR
Present 269  (* flesh lock to tower room *)
ReDirectTo UNLOCK DOOR WITH $OBJECT$
END_COMMAND

COMMAND OPEN DOOR
AtLocation 83  (* troll room *)
FlagON 116  (* door to Outer Room disbelieved *)
PrintMessage 174  (* no substance to door *)
DoneWithTurn
END_COMMAND

COMMAND OPEN DOOR
AtLocation 92  (* iron door *)
FlagON 117  (* lock has been drilled *)
PrintMessage 175  (* door is already open *)
DoneWithTurn
END_COMMAND

COMMAND TURN KEY
ReDirectTo USE KEY
END_COMMAND

COMMAND USE KEY
AtLocation 83  (* troll room *)
OR
AtLocation 92  (* iron door *)
OR
Present 269  (* flesh lock to tower room *)
ReDirectTo UNLOCK DOOR WITH KEY
END_COMMAND

COMMAND USE KEY
NOUNPresent
Present 258  (* iron chest *)
UnLockIt 258  (* iron chest. note: redirecting to UNLOCK ... doesn't work *)
OpenIt 258  (* iron chest *)
PrintMessage 188  (* you open it *)
DoneWithTurn
END_COMMAND

COMMAND USE KEY
Present 200  (* dnd notebook *)
PrintMessage 189  (* sorry ... *)
DoneWithTurn
END_COMMAND

COMMAND EXAMINE LOCK
NOT Present 269  (* strange door not present [handled elsewhere] *)
PrintMessage 181  (* nothing new *)
DoneWithTurn
END_COMMAND


(*** Commands to handle taking the piece of troll flesh needed for the
     recipe.                                                       ***)

COMMAND TAKE FLESH
IsLocated 257 252  (* troll flesh in shiny box *)
PrintMessage 180  (* you already have some *)
DoneWithTurn
END_COMMAND

COMMAND TAKE FLESH
NOT InRoom 257 (* no single piece here *)
InRoom 256  (* but many fragments here *)
ReDirectTo TAKE FRAGMENTS
END_COMMAND

COMMAND TAKE FRAGMENTS
Present 256  (* There are frgaments here *)
PrintMessage 73  (* you can only take 1 *)
GetIt 257  (* pick up single fragment *)
DoneWithTurn
END_COMMAND

COMMAND TAKE ALL
Present 256 (* Fragments here *)
PrintMessage 73  (* you can only take 1 *)
PutInCurrentRoom 257  (* to pick up single fragment *)
END_COMMAND  (* fall through to get everything *)

COMMAND PUT FLESH IN BOX
NOT Present 257  (* troll flesh *)
Present 256  (* Fragments here *)
GetIt 257  (* troll flesh *)
PrintMessage 179  (* you take some of the flesh *)
END_COMMAND  (* now that flesh is taken, drop to normal AGT processing *)


(*** Commands related to the casting of Emergency Evasion from the
     scroll.  You need the Read Magic spectacles to do it.      ***)

COMMAND WEAR SPECTACLES 
NOUNPresent
PrintMessage 77  (* see nothing unusual *)
WearNOUN
DoneWithTurn
END_COMMAND

COMMAND READ SCROLL
NOUNPresent
IsWearing 260  (* you are wearing the spectacles *)
PrintMessage 78  (* you can read the scroll; want to stop? *)
TurnFlagON 255  (* temp. flag to test correctness of answer *)
PromptForYES  (* continue if YES *)
TurnFlagOFF 255  (* done with temp. flag *)
PrintMessage 79  (* you manage to stop *)
DoneWithTurn
END_COMMAND

COMMAND READ SCROLL
FlagON 255  (* he didn't want to stop *)
TurnFlagOFF 255  (* done with temp. flag *)
PrintMessage 80  (* blue tatoos appear *)
DestroyNOUN      (* scroll burns up *)
TurnFlagON 108  (* Phil now has tatoos *)
DoneWithTurn
END_COMMAND


(*** Miscellaneous castle commands ***)

COMMAND EXAMINE SPICE RACK
NOUNPresent
SendToRoom 266 251  (* Jurbura --> spice rack *)
SendToRoom 267 251  (* Muirpuma --> spice rack *)
SendToRoom 268 251  (* Skullcap --> spice rack *)
END_COMMAND  (* drop through to normal examine *)

COMMAND ANY
AtLocation 90  (* study *)
Present 300  (* Tark *)
NOT Present 312  (* undead demoness *)
NOT Present 313  (* ... in either form *)
FlagOFF 11  (* Tark has not examined globe yet *)
PrintMessage 163  (* Tark examines world globe *)
TurnFlagON 11  (* don't print this again *)
END_COMMAND

(*** commands to handle appearance of weird door to Tower Room.  ***)

COMMAND READ BLACK BOOK
NOUNPresent
TurnFlagON 111  (* note that book read at least once *)
END_COMMAND  (* go on to normal processing *)

COMMAND EXAMINE LOCK
Present 269  (* strange door is here *)
ReDirectTo EXAMINE DOOR
END_COMMAND

COMMAND EXAMINE DOOR
Present 269  (* strange door is here *)
FlagON 111  (* black book has been read before *)
PrintMessage 134  (* remember reference in black book *)
TurnFlagON 112  (* he's been told about the reference *)
DoneWithTurn  (* Avoid default examine *)
END_COMMAND

COMMAND EXAMINE DOOR
Present 269  (* strange door is here *)
DescribeThing 269  (* strange door and flesh lock *)
DoneWithTurn
END_COMMAND

COMMAND READ BLACK BOOK
NOUNPresent
FlagON 112  (* been told about reference to flesh lock *)
PrintMessage 135  (* explain about flesh lock *)
WaitForReturn  (* pause before printing normal text *)
TurnFlagOFF 112  (* OK, once is enough *)
END_COMMAND  (* go on to normal text *)

COMMAND ANYBODY, OPEN DOOR
NAMEIsNumber 300  (* TARK, ... *)
Present 300  (* Tark is here *)
Present 269  (* "Wizard Lock" door is here *)
PrintMessage 138  (* she can't *)
DoneWithTurn
END_COMMAND

COMMAND OPEN DOOR
AtLocation 102  (* tower landing --> tower room *)
ReDirectTo ENTER
END_COMMAND

COMMAND NORTH
AtLocation 102  (* tower landing --> tower room *)
ReDirectTo ENTER
END_COMMAND

COMMAND ENTER
AtLocation 102  (* tower landing --> tower room *)
Present 269  (* stangely locked door is here *)
PrintMessage 99  (* Tower Room lock disolves / description of Naron Blooder *)
Destroy 269  (* Get rid of strange lock message on tower landing *)
END_COMMAND  (* pass to next command *)

COMMAND ENTER
AtLocation 102  (* tower landing --> tower hall *)
PrintMessage 139  (* description of Naron Blooder *)
GoToRoom 103  (* ENTER tower room *)
DoneWithTurn
END_COMMAND

(*** Commands for getting Cindy's hair. ***)

COMMAND CUT HAIR
ReDirectTo TAKE HAIR
END_COMMAND

COMMAND TAKE HAIR
Present 310  (* freed Cindy is here *)
PrintMessage 106  (* so you take it *)
GetIt 263  (* now carrying the cindy hair *)
DoneWithTurn
END_COMMAND

COMMAND TAKE HAIR
Present 305  (* mud-house trapped Cindy is here *)
PrintMessage 107  (* sorry ... *)
DoneWithTurn
END_COMMAND


(*** Commands for getting Tears of Sadness for recipe ***)

COMMAND TAKE TEARS
AtLocation 74  (* storage room *)
PrintMessage 109 (* tears dry up *)
DoneWithTurn
END_COMMAND

COMMAND TAKE TEARS IN ANY
RedirectTo PUT TEARS IN $OBJECT$
END_COMMAND

COMMAND PUT TEARS IN VIAL
Present 265 (* perfume vial *)
NOT IsOpen 265  (* perfume vial *)
PrintMessage 190  (* need to open vial first *)
DoneWithTurn
END_COMMAND

COMMAND PUT TEARS IN VIAL
NOT Present 265  (* perfume vial *)
PrintMessage 198  (* what vial? *)
DoneWithTurn
END_COMMAND

COMMAND PUT TEARS IN VIAL
AtLocation 74  (* storage room *)
Present 265 (* perfume vial *)
PrintMessage 110 (* you put tears in vial *)
SendToRoom 264 265 (* put tears in vial *)
DoneWithTurn
END_COMMAND

COMMAND PUT TEARS IN ANY
AtLocation 74  (* storahe room *)
NOT ObjectIsNumber 265  (* perfume vial *)
PrintMessage 191  (* container not appropriate *)
DoneWithTurn
END_COMMAND

(*** Commands for obtaining holy water ***)

COMMAND PUT WATER IN GLASS
RedirectTo TAKE WATER
END_COMMAND

COMMAND PUT WATER IN ANY
NOT ObjectIsNumber 220  (* blender *)
PrintMessage 197  (* container not appropriate *)
DoneWithTurn
END_COMMAND

COMMAND TAKE WATER
AtLocation 3  (* kitchen *)
OR
AtLocation 8 (* master bathroom *)
OR 
AtLocation 14 (* guest bathroom *)
OR
AtLocation 53 (* courtyard *)
Present 215 (* drinking glass *)
PrintMessage 111 (* you put water in glass *)
SendToRoom 216 215 (* water in glass *) 
DoneWithTurn
END_COMMAND

COMMAND TAKE WATER
Present 208  (* burst pipe and water in garage *)
Present 215 (* drinking glass *)
PrintMessage 111 (* you put water in glass *)
SendToRoom 216 215 (* water in glass *) 
DoneWithTurn
END_COMMAND

COMMAND TAKE WATER
AtLocation 3  (* kitchen *)
OR
AtLocation 8 (* master bathroom *)
OR 
AtLocation 14 (* guest bathroom *)
OR
AtLocation 53 (* courtyard *)
NOT Present 215 (* drinking glass *)
PrintMessage 112 (* you need something to put water in: glass *)
DoneWithTurn
END_COMMAND

COMMAND ANYBODY, MAKE HOLY WATER
NAMEIsNumber 300  (* TARK, ... *)
Present 300  (* Tark is here *)
Present 216  (* water is here *)
Present 204  (* gold cross *)
PrintMessage 113  (* Tark makes holy water *)
SwapLocations 216 217 (* water --> holy water *)
DoneWithTurn
END_COMMAND

COMMAND ANYBODY, MAKE HOLY WATER
NAMEIsNumber 300  (* TARK, ... *)
Present 300  (* Tark is here *)
NOT Present 216  (* no water here *)
PrintMessage 114  (* Tark needs water *)
DoneWithTurn
END_COMMAND

COMMAND ANYBODY, MAKE HOLY WATER
NAMEIsNumber 300  (* TARK, ... *)
Present 300  (* Tark is here *)
NOT Present 204  (* gold cross *)
PrintMessage 115  (* Tark needs cross *)
DoneWithTurn
END_COMMAND

COMMAND THROW WATER AT ELEMENTAL
Present 302  (* fire elemental here *)
PrintMessage 116  (* poof!  elemental still there *)
Destroy 216  (* make sure water is gone -- in either form *)
Destroy 217
DoneWithTurn
END_COMMAND


(*** Commands related to blender and grinding recipe ingredients. ***)

COMMAND BLEND
ReDirectTo TURN ON BLENDER
END_COMMAND

COMMAND USE BLENDER
ReDirectTo TURN ON BLENDER
END_COMMAND

COMMAND MIX WITH BLENDER
ReDirectTo TURN ON BLENDER
END_COMMAND

COMMAND MIX
PrintMessage 178  (* you need to use some tool *)
DoneWithTurn
END_COMMAND

COMMAND TURN ON BLENDER
NOT Present 220  (* blender bot here *)
QuitAllCmds  (* so ignore command *)
END_COMMAND

COMMAND TURN ON BLENDER
NOT Present 218  (* no electrical outlet here *)
PrintMessage 121  (* can't find an outlet *)
DoneWithTurn
END_COMMAND

COMMAND TURN ON BLENDER
NOT SomethingInside 220  (* blender is empty *)
PrintMessage 117  (* wrrrr... *)
DoneWithTurn
END_COMMAND

COMMAND TURN ON BLENDER
IsLocated 280 220  (* purple mush in blender *)
Destroy 280  (* we'll replace it later *)
NOT SomethingInside 220  (* that was all *)
SendToRoom 280 220  (* put purple mush back *)
TurnCounterON 9  (* and restart troll regeneration from beginning *)
PrintMessage 129  (* troll flesh chunks cut up again *)
DoneWithTurn
END_COMMAND

COMMAND TURN ON BLENDER
IsLocated 281 220  (* some mush in blender *)
Destroy 281  (* we'll replace it later *)
NOT SomethingInside 220  (* that was all *)
SendToRoom 281 220  (* put some mush back *)
TurnCounterON 9  (* and restart troll regeneration from beginning *)
PrintMessage 129  (* troll flesh chunks cut up again *)
DoneWithTurn
END_COMMAND

(* now something is in the blender *)

COMMAND TURN ON BLENDER
TurnFlagOFF 5  (* no wrong items detected so far *)
SetVariableTo 1 0  (* so far, no recipe items found in blender *)
END_COMMAND

COMMAND TURN ON BLENDER
IsLocated 217 220  (* holy water in blender *)
Destroy 217  (* gets ground up *)
AddToVariable 1 1  (* increment # recipe items found *)
END_COMMAND

COMMAND TURN ON BLENDER
IsLocated 237 220  (* twinkie in blender *)
Destroy 237  (* gets ground up *)
AddToVariable 1 1  (* increment # recipe items found *)
END_COMMAND

(* !!! Fix up troll regeneration !!! *)
COMMAND TURN ON BLENDER
IsLocated 257 220  (* troll flesh in blender *)
Destroy 257  (* gets ground up *)
TurnCounterON 9  (* restart regeneration *)
AddToVariable 1 1  (* increment # recipe items found *)
END_COMMAND

COMMAND TURN ON BLENDER
IsLocated 262 220  (* black heart in blender *)
Destroy 262  (* gets ground up *)
AddToVariable 1 1  (* increment # recipe items found *)
END_COMMAND

COMMAND TURN ON BLENDER
IsLocated 263 220  (* cindy hair in blender *)
Destroy 263  (* gets ground up *)
AddToVariable 1 1  (* increment # recipe items found *)
END_COMMAND

COMMAND TURN ON BLENDER
IsLocated 264 220  (* Tears of Sadness in blender *)
Destroy 264  (* gets ground up *)
AddToVariable 1 1  (* increment # recipe items found *)
END_COMMAND

COMMAND TURN ON BLENDER
IsLocated 266 220  (* Jurbura in blender *)
Destroy 266  (* gets ground up *)
AddToVariable 1 1  (* increment # recipe items found *)
END_COMMAND

COMMAND TURN ON BLENDER
IsLocated 216 220  (* wrong: normal water in blender *)
Destroy 216  (* gets ground up *)
TurnFlagON 5  (* recipe screwed up *)
END_COMMAND

COMMAND TURN ON BLENDER
IsLocated 267 220  (* wrong: MuiraPuma in blender *)
Destroy 267  (* gets ground up *)
TurnFlagON 5  (* recipe screwed up *)
END_COMMAND

COMMAND TURN ON BLENDER
IsLocated 268 220  (* wrong: skullcap in blender *)
Destroy 268  (* gets ground up *)
TurnFlagON 5  (* recipe screwed up *)
END_COMMAND

COMMAND TURN ON BLENDER
IsLocated 250 220  (* wrong: paisley cake in blender *)
Destroy 250  (* gets ground up *)
TurnFlagON 5  (* recipe screwed up *)
END_COMMAND

COMMAND TURN ON BLENDER
IsLocated 276 220  (* wrong: chocolate cheesecake in blender *)
Destroy 276  (* gets ground up *)
TurnFlagON 5  (* recipe screwed up *)
END_COMMAND

COMMAND TURN ON BLENDER
IsLocated 277 220  (* wrong: apple crisp in blender *)
Destroy 277  (* gets ground up *)
TurnFlagON 5  (* recipe screwed up *)
END_COMMAND

COMMAND TURN ON BLENDER
SomethingInside 220  (* something still left in blender *)
PrintMessage 120  (* it clogs/breaks blender *)
SendToRoom 281 220  (* put unmagical mush in blender *)
DoneWithTurn
END_COMMAND

COMMAND TURN ON BLENDER
VariableEquals 1 7  (* all recipe items were present *)
FlagOFF 5  (* and no wrong items included *)
SendToRoom 280 220  (* put purple mush in blender *)
PrintMessage 118  (* you make foaming purple mush *)
DoneWithTurn
END_COMMAND

COMMAND TURN ON BLENDER
PrintMessage 119  (* you make some mush *)
SendToRoom 281 220  (* put mush in blender *)
DoneWithTurn
END_COMMAND


(*** Commands for handling extension cord, which must be plugged into
     outlet and dropped in the blended mus ho substitute for the
     Shocking Grasp in the recipe.                                 ***)

COMMAND PLUG ANY IN EXTENSION CORD
NOUNIsNumber 0  (* commands was "PLUG IN EXTENSION CORD" *)
PrintMessage 199  (* plug extension cord into what? *)
DoneWithTurn
END_COMMAND

REM
REM  A bug I don't understand redirects PLUG IN EXTENSION CORD to PLUG
REM  EXTENSION CORD into EXTENSION CORD.  This is the kluge fix.
REM
COMMAND PLUG ANY IN EXTENSION CORD
NOUNIsNumber 219  (* extension cord *)
PrintMessage 199  (* plug extension cord into what? *)
DoneWithTurn
END_COMMAND

COMMAND PLUG ANY
NOUNPresent
ObjectIsNumber 0  (* No object specified *)
PrintMessage 122
DoneWithTurn
END_COMMAND

COMMAND PUT EXTENSION CORD INTO OUTLET
ReDirectTo PLUG EXTENSION CORD INTO OUTLET
END_COMMAND

COMMAND PLUG EXTENSION CORD INTO OUTLET
Present 219  (* extension cord *)
Present 218  (* outlet present *)
IsLocated 219 220  (* cord in blender *)
OR
IsLocated 219 280  (* or in purple mush *)
OR
IsLocated 219 281  (* or in some mush *)
SendToRoom 219 218  (* put the cord in the outlet *)
ReDirectTo PUT EXTENSION CORD INTO MUSH
END_COMMAND  (* handle the shock *)

COMMAND PLUG EXTENSION CORD INTO OUTLET
Present 219  (* extension cord *)
Present 218  (* outlet present *)
PrintMessage 123  (* ok *)
SendToRoom 219 218  (* put the cord in the outlet *)
DoneWithTurn
END_COMMAND

COMMAND PLUG ANY INTO EXTENSION CORD
ReDirectTo PLUG EXTENSION CORD INTO $NOUN$
END_COMMAND

COMMAND PLUG EXTENSION CORD INTO BLENDER
Present 219  (* extension cord *)
Present 220  (* blender *)
PrintMessage 123  (* ok *)
TurnFlagOFF 6  (* extension cord not plugged into drill *)
DoneWithTurn
END_COMMAND

COMMAND PLUG EXTENSION CORD INTO DRILL
Present 219  (* extension cord *)
Present 213  (* power drill *)
PrintMessage 124  (* sorry, you can't *)
DoneWithTurn
END_COMMAND

COMMAND PLUG EXTENSION CORD INTO ANY
Present 219  (* extension cord *)
PrintMessage 125  (* you can't plug it into that *)
DoneWithTurn
END_COMMAND

COMMAND UNPLUG EXTENSION CORD
NOUNPresent
PrintMessage 126  (* ok, unplugged from everything *)
PutNOUNInCurrentRoom  (* make sure it's no longer in outlet *)
DoneWithTurn
END_COMMAND

COMMAND DROP EXTENSION CORD IN ANY
ReDirectTo PUT EXTENSION CORD IN ANY
END_COMMAND

COMMAND PUT EXTENSION CORD IN BLENDER
IsLocated 280 220  (* purple mush in blender *)
ReDirectTo PUT EXTENSION CORD IN PURPLE MUSH
END_COMMAND

COMMAND PUT EXTENSION CORD IN BLENDER
IsLocated 281 220  (* some mush in blender *)
ReDirectTo PUT EXTENSION CORD IN SOME MUSH
END_COMMAND

COMMAND PUT EXTENSION CORD IN SOME MUSH
Present 219  (* extension cord *)
Present 281  (* some mush *)
IsLocated 219 218  (* cord in outlet *)
PrintMessage 128  (* flash! -- no good *)
DoneWithTurn
END_COMMAND

COMMAND PUT EXTENSION CORD IN PURPLE MUSH
NOT Present 219  (* extension cord *)
OR
NOT Present 280  (* purple mush *)
OR
NOT IsLocated 219 218  (* cord not in outlet *)
QuitAllCmds  (* command not appropriate or nothing special happens *)
END_COMMAND

COMMAND PUT EXTENSION CORD IN PURPLE MUSH
IsLocated 232 220  (* credit cards in blender *)
IsLocated 233 220  (* floppy disk in blender *)
IsLocated 234 220  (* bank list in blender *)
Destroy 232  (* credit cards *)
Destroy 233  (* floppy disk *)
Destroy 235  (* bank list *)
TurnFlagON 7  (* everything here *)
END_COMMAND


(* Due to apparent bug (?), following command must be split up. *)
COMMAND PUT EXTENSION CORD IN PURPLE MUSH
IsLocated 231 220 (* tagged pouch in blender or in purple mush *)
OR
IsLocated 231 280
TurnFlagON 255  (* use temp. flag for continuation *)
END_COMMAND

(* ... continued ... *)
COMMAND PUT EXTENSION CORD IN PURPLE MUSH
FlagON 255  (* continued from last command *)
TurnFlagOFF 255  (* done with temp. flag *)
IsLocated 232 220  (* credit cards in blender or pouch or mush *)
OR
IsLocated 232 231
OR
IsLocated 232 280
TurnFlagON 255  (* use temp. flag for continuation *)
END_COMMAND

(* ... continued ... *)
COMMAND PUT EXTENSION CORD IN PURPLE MUSH
FlagON 255  (* continued from last command *)
TurnFlagOFF 255  (* done with temp. flag *)
IsLocated 233 220  (* floppy disk in blender or pouch or mush *)
OR
IsLocated 233 231
OR
IsLocated 233 280
TurnFlagON 255  (* use temp. flag for continuation *)
END_COMMAND

(* ... continued ... *)
COMMAND PUT EXTENSION CORD IN PURPLE MUSH
FlagON 255  (* continued from last command *)
TurnFlagOFF 255  (* done with temp. flag *)
IsLocated 234 220  (* bank list in blender or pouch or mush *)
OR
IsLocated 234 231
OR
IsLocated 234 280
TurnFlagON 255  (* temp. flag on *)
END_COMMAND

(* ... continued ... *)
COMMAND PUT EXTENSION CORD IN PURPLE MUSH
FlagON 255  (* continued from last command *)
TurnFlagOFF 255  (* done with temp. flag *)
Destroy 231  (* tagged puch *)
Destroy 232  (* credit cards *)
Destroy 233  (* floppy disk *)
Destroy 235  (* bank list *)
TurnFlagON 7  (* everything here *)
END_COMMAND


COMMAND PUT EXTENSION CORD IN PURPLE MUSH
FlagON 7  (* all of thieve's tools in purple mush *)
PrintMessage 127  (* flash! *)
SwapLocations 280 282  (* purple mush --> reagent *)
DoneWithTurn
END_COMMAND

COMMAND PUT EXTENSION CORD IN PURPLE MUSH
FlagOFF 7  (* not all of thieve's tools in purple mush *)
PrintMessage 128  (* flash! -- no good *)
DoneWithTurn
END_COMMAND


(*** Commands for pouring the reagent on the book and winning the
     game.                                                        ***)

COMMAND PUT LIQUID ON LOCK
ReDirectTo PUT LIQUID ON NOTEBOOK
END_COMMAND

COMMAND PUT LIQUID ON NOTEBOOK
NOT NOUNPresent
OR
NOT Present 200  (* dnd notebook *)
QuitAllCmds (* let AGT handle it *)
END_COMMAND

COMMAND PUT LIQUID ON NOTEBOOK
PrintMessage 130  (* the lock disolves *)
Present 300  (* If Tark is here ... *)
PrintMessage 131  (* ... she fades away *)
END_COMMAND (* in either case, drop through to next part *)

COMMAND PUT LIQUID ON NOTEBOOK
PrintMessage 132  (* hoorah!  you win! *)
WaitForReturn
PlusScore 10  (* worth ten points *)
WinGame
DoneWithTurn
END_COMMAND

COMMAND PUT MUSH ON LOCK
ReDirectTo PUT MUSH ON NOTEBOOK
END_COMMAND

COMMAND PUT MUSH ON NOTEBOOK
NOUNPresent
Present 200  (* dnd notebook *)
PrintMessage 133  (* not much happens *)
DoneWithTurn
END_COMMAND


(*** Commands to implement Paisley Cake trick for getting into the study.
     Player must substitute paisley Cake on tray in kitchen.  Butler then
     comes and delivers tray to demoness.  Demoness gets horny.  Will wait
     in the stuidy for awhile, and then she rushes out and becomes a
     random encounter.  We ensure that a random encounter doesn't take
     place when other hostiles are present since the half-hour scene would
     be implausible then.                                               ***)

COMMAND ANY
AtLocation 86  (* Long Hall *)
FlagOFF 8  (* butler never appeared before in short hall *)
PrintMessage 141  (* he does, delivering tray to study and leaving *)
NOT IsLocated 273 60  (* silver tray removed from kitchen *)
SendToRoom 274 60  (* butler prepares another dessert tray *)
END_COMMAND

COMMAND ANY
AtLocation 86  (* Long Hall *)
FlagOFF 8  (* butler just appeared above *)
IsLocated 272 60  (* dinner tray still in castle kitchen *)
Destroy 272  (* it's been delivered now *)
SendToRoom 283 90  (* put empty dinner tray in study *)
END_COMMAND

COMMAND ANY
AtLocation 86  (* Long Hall *)
FlagOff 8  (* butler just appeared above *)
TurnFlagON 8  (* we handled it above, just need to... *)
DoneWithTurn  (* ...interrupt whatever Phil was doing *)
END_COMMAND

COMMAND PUT PAISLEY CAKE ON DINNER TRAY
NOUNPresent
OBJECTPresent
ObjectIsNumber 272  (* dinner tray *)
SendToRoom 250 272  (* Paisely cake --> tray *)
PrintMessage 157  (* you do it *)
DoneWithTurn
END_COMMAND

COMMAND PUT PAISLEY CAKE ON SILVER TRAY
NOUNPresent
OBJECTPresent
ObjectIsNumber 273  (* the silver tray *)
SomethingInside 273  (* something already there *)
PrintMessage 182  (* no room *)
DoneWithTurn
END_COMMAND

COMMAND PUT PAISLEY CAKE ON GOLD TRAY
NOUNPresent
OBJECTPresent
ObjectIsNumber 274  (* the gold tray *)
SomethingInside 274  (* something already there *)
PrintMessage 182  (* no room *)
DoneWithTurn
END_COMMAND

COMMAND PUT PAISLEY CAKE ON SILVER TRAY
NOUNPresent
OBJECTPresent
ObjectIsNumber 273  (* silver tray *)
SendToRoom 250 273  (* Paisely cake --> tray *)
PrintMessage 157  (* you do it *)
DoneWithTurn
END_COMMAND

COMMAND PUT PAISLEY CAKE ON GOLD TRAY
NOUNPresent
OBJECTPresent
ObjectIsNumber 274  (* gold tray *)
SendToRoom 250 274  (* Paisely cake --> tray *)
PrintMessage 157  (* you do it *)
DoneWithTurn
END_COMMAND

COMMAND ANY
IsLocated 250 272  (* Paisely Cake left on dinner tray *)
IsLocated 272 60   (* which is in kitchen *)
TurnFlagON 9  (* will be delivered *)
TurnFlagON 8  (* forget seeing butler first time in long hall *)
Destroy 272  (* will be taken now by butler *)
SendToRoom 283 90  (* put empty dinner tray in study *)
END_COMMAND

COMMAND ANY
IsLocated 250 273  (* Paisley Cake left on dessert tray *)
IsLocated 273 60  (* which is in kitchen *)
TurnFlagON 9  (* it will be delivered *)
TurnFlagON 8  (* forget seeing butler first time in long hall *)
Destroy 273  (* will be taken now by butler *)
SendToRoom 284 90  (* put empty dessert tray in study *)
END_COMMAND

COMMAND ANY
IsLocated 250 274  (* Paisely Cake left on 2nd dessert tray *)
IsLocated 274 60  (* in kitchen *)
TurnFlagON 9  (* will be delivered *)
TurnFlagON 8  (* forget seeing butler first time in long hall *)
Destroy 274  (* will be taken now by butler *)
SendToRoom 285 90  (* put empty 2nd dessert tray in study *)
END_COMMAND

COMMAND ANY
FlagON 9  (* Paisely Cake set up for delivery *)
SwapLocations 312 313  (* demoness --> amorous demoness *)
TurnCounterON 11  (* time horny demoness been in study *)
NOT AtLocation 60  (* castle kitchen *)
TurnFlagOFF 9  (* don't need flag anymore *)
END_COMMAND

COMMAND ANY
FlagON 9  (* Paisley Cake delivered above, Phil in kitchen *)
NOT InRoom 272  (* cake was on dinner tray or dinner tray not around *)
PrintMessage 147  (* butler enters and takes tray with Paisely Cake *)
TurnFlagOFF 9  (* don't need flag now *)
DoneWithTurn  (* interrupted whatever Phil was doing *)
END_COMMAND

COMMAND ANY
FlagON 9  (* Paisley cake delivered above, dinner tray still around *)
PrintMessage 168  (* butler takes both dessert and dinner tray *)
TurnFlagOFF 9  (* don't need flag now *)
Destroy 272  (* dinner tray *)
SendToRoom 283 90  (* empty dinner tray --> study *) 
DoneWithTurn  (* interrupted whatever Phil was doing *)
END_COMMAND

COMMAND ANY
Present 313  (* amorous demoness *)
FlagOFF 106  (* Phil is male *)
FlagON 105  (* Tark is male *)
Present 300  (* Tark is here *)
PrintMessage 148  (* they are "attacked" by demoness *)
Destroy 313  (* demoness runs off *)
DoneWithTurn
END_COMMAND

COMMAND ANY
Present 313  (* horny demoness *)
FlagOFF 106  (* Phil is male *)
PrintMessage 149  (* Phil is "attacked" by horny demoness *)
Destroy 313  (* demoness runs off *)
DoneWithTurn
END_COMMAND

COMMAND ANY
Present 313  (* horny demoness *)
FlagON 105  (* Tark is male *)
Present 300  (* Tark is here *)
PrintMessage 150  (* Tark "attacked" by horny demoness *)
Destroy 313  (* demoness runs off *)
DoneWithTurn
END_COMMAND

COMMAND ANY
Present 313  (* horny demoness *)
PrintMessage 151  (* no males -- frustrated demoness runs away *)
Destroy 313  (* demoness runs off *)
END_COMMAND  (* phil can do whatever he was doing *)

COMMAND ANY
CounterGT 11 20  (* demoness has been in study for awhile *)
NOT Present 313  (* and is not here *)
IsSomewhere 313  (* and is still alive *)
TurnFlagON 10  (* she leaves in search of men --> random monster *)
PrintMessage 156  (* you hear a frustrated shriek *)
TurnCounterOFF 11  (* counter no longer needed *)
Destroy 313  (* no longer in study *)
END_COMMAND

COMMAND WAIT
CounterGT 11 1  (* horny demoness is fidgeting in study *)
NOT Present 313  (* and is not here *)
NOT AtLocation 85  (* long hall *)
NOT AtLocation 86  (* short hall *)
IsSomewhere 313  (* demoness still alive *)
TurnFlagON 10  (* she leaves in search of men --> random monster *)
PrintMessage 155  (* you hear a frustrated shriek *)
TurnCounterOFF 11  (* counter no longer needed *)
Destroy 313  (* no longer in study *)
DoneWithTurn
END_COMMAND

COMMAND WAIT
CounterGT 11 1  (* horny demoness is fidgeting in study *)
NOT Present 313  (* and is not here *)
AtLocation 85  (* long hall *)
OR
AtLocation 89  (* short hall *)
IsSomewhere 313  (* demoness still alive *)
PrintMessage 154  (* she runs out of study and sees you *)
PutInCurrentRoom 313  (* demoness appears *)
DoneWithTurn
END_COMMAND

COMMAND ANY
FlagON 10 (* demoness is horny and out of study *)
AtLocationGT 49  (* Phil is in castle *)
NOT AtLocation 83  (* not where phil can be attacked ... troll room *)
NOT Present 307  (* ... charmed snakes *)
NOT Present 308  (* ... animated skeletons *)
NOT Present 309  (* ... troll lord *)
NOT Present 311  (* ... demigod *)
NOT Present 314  (* ... guard *)
FlagOFF 114  (* guard not coming *)
TurnFlagON 255  (* set temp. flag to continue with next command *)
END_COMMAND

COMMAND ANY
FlagON 255  (* cont'd from previous command *)
TurnFlagOFF 255  (* done with temp. flag *)
RandomVariable 25 100  (* 1 in 100 chance of demoness showing up *)
VariableEquals 25 1
PrintMessage 152 (* demoness shows up *)
PutInCurrentRoom 313  (* put amorous demon here *)
TurnFlagOFF 10  (* demoness wil not bother them again *)
END_COMMAND  (* process whatever Phil was doing *)


(*** Commands to implement patrolling guard. ***)

COMMAND ANY
AtLocationGT 52  (* Phil inside castle, has reached courtyard *)
CounterEquals 12 0  (* guard not patrolling yet *)
TurnCounterON 12  (* start guard patrolling *)
END_COMMAND

(* guard is moving *)

COMMAND ANY
FlagON 113  (* guard is supposed to move this turn *)
FlagOFF 114  (* Phil wasn't in guard's next room for warning *)
OR
VerbIsDirection  (* Phil trying to move away *)
MakeVarRoomNum 25  (* current room number --> temp. variable *)
SubtractVariables 25 10  (* subtract next room # of guard's rounds *)
VariableEquals 25 0  (* Phil is now in guard's next room *)
TurnFlagOFF 113  (* delay for a round so that he can get warning *)
END_COMMAND

COMMAND ANY
FlagON 113  (* move guard this turn [set below] *)
NOT Present 314  (* guard not attacking Phil *)
IsSomewhere 314  (* guard not dead *)
SendToVariableRoom 314 10  (* move guard to next room of his rounds *)
TurnFlagOFF 113  (* he's moved now *)
TurnCounterON 12  (* start counting time he's in current room *)
TurnFlagOFF 114  (* reinitialize: no warnings yet of subsequent move *)
Present 314  (* if guard now in current room ... *)
PrintMessage 161  (* ... let Phil know *)
END_COMMAND

COMMAND ANY
CounterGT 12 2  (* guard will move next turn *)
IsSomewhere 314  (* guard is still alive *)
TurnFlagON 113  (* move guard next turn *)
FlagOFF 114  (* no warning yet given of guard's approach *)
MakeVarRoomNum 25  (* current room number --> temp. variable *)
SubtractVariables 25 10  (* subtract next room # of guard's rounds *)
VariableEquals 25 0  (* guard moving into current room *)
PrintVariableMessage 20  (* hear guard approach from relevant direction *)
TurnFlagON 114  (* Warning given *)
END_COMMAND

(* definition of the guards's rounds *)

COMMAND ANY
SetVariableTo 11  0  (* room to north: none *)
SetVariableTo 12  0  (* room to west: none *)
SetVariableTo 13  0  (* room to south: none *)
SetVariableTo 14  0  (* room to east: none *)
SetVariableTo 15  0  (* room up: none *)
SetVariableTo 16  0  (* room down: none *)
SetVariableTo 17  0  (* room northwest: none *)
SetVariableTo 18  0  (* room southwest: none *)
SetVariableTo 19  0  (* room "enter": none *)
END_COMMAND

COMMAND ANY
IsLocated 314 58  (* guard in main hall *)
SetVariableTo 10 80  (* next room he will visit: upper hall *)
SetVariableTo 12 59  (* room to west: dining room *)
SetVariableTo 13 53  (* room to south: courtyard *)
SetVariableTo 14 57  (* room to east: tapestry room *)
SetVariableTo 15 80  (* room up: upper hall *)
SetVariableTo 20 214 (* message when guard leaves: moving up *)
END_COMMAND

COMMAND ANY
IsLocated 314 80  (* guard in upper hall *)
SetVariableTo 10 85  (* next room he will visit: library *)
SetVariableTo 12 85  (* room to west: library *)
SetVariableTo 14 81  (* room to east: sex-change room *)
SetVariableTo 16 58  (* room down: upper hall *)
SetVariableTo 20 213 (* message when guard leaves: moving west *)
END_COMMAND

REM  (* short loop for tesing: main hall <--> upper hall *)
REM  COMMAND ANY
REM  IsLocated 314 80  (* guard in upper hall *)
REM  SetVariableTo 10 58  (* next room he will visit: main hall *)
REM  SetVariableTo 12 85  (* room to west: library *)
REM  SetVariableTo 14 82  (* room to east: sex-change room *)
REM  SetVariableTo 16 58  (* room down: upper hall *)
REM  SetVariableTo 20 215 (* message when guard leaves: moving down *)
REM  END_COMMAND

COMMAND ANY
IsLocated 314 85  (* guard in library *)
SetVariableTo 10 86  (* next room he will visit: long hall *)
SetVariableTo 13 86  (* room to south: long hall *)
SetVariableTo 14 80  (* room to east: upper hall *)
SetVariableTo 20 210 (* message when guard leaves: moving south *)
END_COMMAND

COMMAND ANY
IsLocated 314 86  (* guard in long hall *)
SetVariableTo 10 89  (* next room he will visit: short hall *)
SetVariableTo 11 85  (* room to north: library *)
SetVariableTo 13 89  (* room to south: short hall *)
SetVariableTo 17 87  (* room to northwest: north bedroom *)
SetVariableTo 18 88  (* room to southwest: south bedroom *)
SetVariableTo 20 210 (* message when guard leaves: moving south *)
END_COMMAND

COMMAND ANY
IsLocated 314 89  (* guard in short hall *)
SetVariableTo 10 61  (* next room he will visit: servant's hall *)
SetVariableTo 11 86  (* room to north: long hall *)
SetVariableTo 14 90  (* room to east: study *)
SetVariableTo 16 61  (* room down: servant's hall *)
SetVariableTo 20 215 (* message when guard leaves: moving down *)
END_COMMAND

COMMAND ANY
IsLocated 314 61  (* guard in servant's hall *)
SetVariableTo 10 60  (* next room he will visit: kitchen *)
SetVariableTo 11 60  (* room to north: kitchen *)
SetVariableTo 14 62  (* room to east: servant's quarters *)
SetVariableTo 15 89  (* room up: short hall *)
SetVariableTo 20 212 (* message when guard leaves: moving north *)
END_COMMAND

COMMAND ANY
IsLocated 314 60  (* guard in kitchen *)
SetVariableTo 10 53  (* next room he will visit: courtyard *)
SetVariableTo 11 59  (* room to north: dining room *)
SetVariableTo 13 61  (* room to south: servant's hall *)
SetVariableTo 14 53  (* room to east: courtyard *)
SetVariableTo 20 211 (* message when guard leaves: moving east *)
END_COMMAND

COMMAND ANY
IsLocated 314 53  (* guard in courtyard *)
SetVariableTo 10 55  (* next room he will visit: statue gallery *)
SetVariableTo 11 58  (* room to north: main hall *)
SetVariableTo 12 60  (* room to west: kitchen *)
SetVariableTo 13 50  (* room to south: entry way *)
SetVariableTo 14 55  (* room to east: statue gallery *)
SetVariableTo 19 54  (* room to "enter": mud house *)
SetVariableTo 20 211 (* message when guard leaves: moving east *)
END_COMMAND

COMMAND ANY
IsLocated 314 55  (* guard in statue gallery *)
SetVariableTo 10 56  (* next room he will visit: conference room *)
SetVariableTo 11 56  (* room to north: conference room *)
SetVariableTo 12 53  (* room to west: courtyard *)
SetVariableTo 20 212 (* message when guard leaves: moving north *)
END_COMMAND

COMMAND ANY
IsLocated 314 56  (* guard in conference room *)
SetVariableTo 10 57  (* next room he will visit: tapestry room *)
SetVariableTo 11 57  (* room to north: tapestry room *)
SetVariableTo 13 55  (* room to south: statue gallery *)
SetVariableTo 20 212 (* message when guard leaves: moving north *)
END_COMMAND

COMMAND ANY
IsLocated 314 57  (* guard in tapestry room *)
SetVariableTo 10 58  (* next room he will visit: main hall *)
SetVariableTo 12 58  (* room to west: main hall *)
SetVariableTo 13 56  (* room to south: conference room *)
SetVariableTo 20 213 (* message when guard leaves: moving west *)
END_COMMAND

REM  (* for debugging *)
REM  COMMAND ANY
REM  PrintMessage 216  (* where will guard go next *)
REM  END_COMMAND

(* Phil tries to move into room with guard *)

COMMAND NORTH
MakeVarRoomNum 25  (* current room number --> temp. variable *)
SubtractVariables 25 13  (* subtract room # south of guard *)
VariableEquals 25 0  (* we are south of guard *)
PrintMessage 158  (* you hear guard in next room *)
PromptForNO  (* don't continue? *)
DoneWithTurn  (* abort move *)
END_COMMAND


COMMAND WEST
MakeVarRoomNum 25  (* current room number --> temp. variable *)
SubtractVariables 25 14  (* subtract room # east of guard *)
VariableEquals 25 0  (* we are east of guard *)
PrintMessage 158  (* you hear guard in next room *)
PromptForNO  (* don't continue? *)
DoneWithTurn  (* abort move *)
END_COMMAND

COMMAND SOUTH
MakeVarRoomNum 25  (* current room number --> temp. variable *)
SubtractVariables 25 11  (* subtract room # north of guard *)
VariableEquals 25 0  (* we are south of guard *)
PrintMessage 158  (* you hear guard in next room *)
PromptForNO  (* don't continue? *)
DoneWithTurn  (* abort move *)
END_COMMAND

COMMAND EAST
MakeVarRoomNum 25  (* current room number --> temp. variable *)
SubtractVariables 25 12  (* subtract room # west of guard *)
VariableEquals 25 0  (* we are south of guard *)
PrintMessage 158  (* you hear guard in next room *)
PromptForNO  (* don't continue? *)
DoneWithTurn  (* abort move *)
END_COMMAND

COMMAND UP
MakeVarRoomNum 25  (* current room number --> temp. variable *)
SubtractVariables 25 16  (* subtract room # down from guard *)
VariableEquals 25 0  (* we are down from guard *)
PrintMessage 158  (* you hear guard in next room *)
PromptForNO  (* don't continue? *)
DoneWithTurn  (* abort move *)
END_COMMAND

COMMAND DOWN
MakeVarRoomNum 25  (* current room number --> temp. variable *)
SubtractVariables 25 15  (* subtract room # up from guard *)
VariableEquals 25 0  (* we are up from guard *)
PrintMessage 158  (* you hear guard in next room *)
PromptForNO  (* don't continue? *)
DoneWithTurn  (* abort move *)
END_COMMAND

COMMAND NORTHEAST
MakeVarRoomNum 25  (* current room number --> temp. variable *)
SubtractVariables 25 18  (* subtract room # southwest of guard *)
VariableEquals 25 0  (* we are southwest of guard *)
PrintMessage 158  (* you hear guard in next room *)
PromptForNO  (* don't continue? *)
DoneWithTurn  (* abort move *)
END_COMMAND

COMMAND SOUTHEAST
MakeVarRoomNum 25  (* current room number --> temp. variable *)
SubtractVariables 25 17  (* subtract room # northwest of guard *)
VariableEquals 25 0  (* we are northwest of guard *)
PrintMessage 158  (* you hear guard in next room *)
PromptForNO  (* don't continue? *)
DoneWithTurn  (* abort move *)
END_COMMAND


(* These commands must be last *)
(* !!! Should later be moved so only last of ANYBODY, ... commands !!! *)


COMMAND ANYBODY, ANY
NAMEIsNumber 300  (* Tark is being adressed *)
Present 300  (* Tark is here *)
PrintMessage 8  (* Tark doesn't pay heed *)
DoneWithTurn
END_COMMAND

COMMAND ANYBODY, ANY
NAMEIsNumber 305  (* Cindy trapped in mud-house *)
OR
NAMEIsNumber 310  (* free Cindy *)
Present 305  (* she is here *)
OR
Present 310
PrintMessage 140  (* sorry ... *)
END_COMMAND


(*** Commands to handle Phil's death.  If he's tatood, he gets resurrected
     in Mantel's mansion.  If he's not, then he dies.  We don't handle the
     normal AGT resurrection, but we move him to a DEATH room so that he has
     the opportunity to restore previous states of the same.  These commands
     must come at the end of the AGT file.                               ***)

COMMAND KILL_ALL
GoToRoom 197  (* kill others in irrelevant room to avoid LOOK bug *)
Destroy 300  (* Tark dies *)
Destroy 310  (* Cindy dies *)
ReDirectTo KILL_PLAYER
END_COMMAND  (* Phil dies *)

COMMAND KILL_PLAYER
RemoveFromGroup 300  (* Tark doesn't follow to death or safety *)
RemoveFromGroup 310  (* nor Cindy *)
RemoveEverything (* nor anything else *)
DropEverything
TurnCounterOFF 10  (* no hostiles present anymore *)
GoToRoom 199  (* death *)
END_COMMAND

COMMAND KILL_PLAYER
FlagOFF 108  (* Phil does not have emergency evasion tatoos *)
Tone 196 1013  (* "March of the Dolls" *)
Tone   0   23
Tone 196  563
Tone   0   23
Tone 196  450
Tone   0   23
Tone 196  900
Tone 233  675
END_COMMAND

COMMAND KILL_PLAYER
FlagOFF 108  (* Phil does not have emergency evasion tatoos *)
Tone 220  338  (* cont'd *)
Tone   0   23
Tone 220  675
Tone 196  338
Tone   0   23
Tone 196  675
Tone 185  450
Tone 196  900
DoneWithTurn  (* dead for good *)
END_COMMAND

COMMAND KILL_PLAYER
TurnFlagOFF 108  (* Phil saved by tatoos -- all used up now *)
AddToGroup 300  (* Tark will follow when next they meet *)
AddToGroup 310  (* as will Cindy *)
AtLocationLT 50  (* Phil was outside castle *)
GoToRoom 15  (* then he ends in mansion inside bedroom *)
END_COMMAND

COMMAND KILL_PLAYER
AtLocationGT 49  (* Phil was inside castle *)
GoToRoom 63  (* then he ends up in mansion in courtyard *)
END_COMMAND

COMMAND KILL_PLAYER
FlagON 106  (* Phil is currently female *)
OR
FlagON 109  (* or he is currently a eunich *)
PutInCurrentRoom 295  (* "you are now male" message *)
TurnFlagOFF 106  (* Phil is now male *)
END_COMMAND

COMMAND KILL_PLAYER
DoneWithTurn
END_COMMAND
